/*
 * Copyright(c) 2018-? the original author[Wien(luweien@aliyun.com)] or authors.
 *
 */
package org.doll.it.base.domain;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.doll.it.base.enums.StatusEnum;
import org.springframework.data.domain.Persistable;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* DO(Domain/Data Object)基类，仅包含ID和状态
* 
* @author Wien(luweien@aliyun.com)
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@MappedSuperclass
public class BaseDO extends RootDO implements Persistable<Long> {

	private static final long serialVersionUID = 3516542075462956451L;

	/**
	 * 主键，唯一
	 */
	@Id
	@GeneratedValue
	protected Long id;

	/**
	 * 状态
	 */
	protected StatusEnum status;

	/**
	 * 是否新建：当id为空时
	 */
	@Override
	public boolean isNew() {
		return id == null;
	}
}
